package org.lan.permission.dao.impl;

import java.util.List;

import org.lan.basic.impl.BaseDao;
import org.lan.permission.dao.IUserRoleDao;
import org.lan.permission.entity.Role;
import org.lan.permission.entity.UserRole;
import org.springframework.stereotype.Repository;

@Repository
@SuppressWarnings("unchecked")
public class UserRoleDao extends BaseDao<UserRole>implements IUserRoleDao {

	@Override
	public List<Role> findByUsername(String username) {
		String hql = "SELECT ur.role FROM UserRole ur WHERE ur.user.username = ?";
		return (List<Role>) list(hql, username);
	}

}
